package com.app.bimo.library_db.dao;

import android.database.Cursor;
import android.database.sqlite.SQLiteStatement;

import org.greenrobot.greendao.AbstractDao;
import org.greenrobot.greendao.Property;
import org.greenrobot.greendao.internal.DaoConfig;
import org.greenrobot.greendao.database.Database;
import org.greenrobot.greendao.database.DatabaseStatement;

import com.app.bimo.library_db.ADConfigData;
import com.app.bimo.library_db.ADConfigDataConvert;

import com.app.bimo.library_db.ADConfigResultData;

// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.
/** 
 * DAO for table "ADCONFIG_RESULT_DATA".
*/
public class ADConfigResultDataDao extends AbstractDao<ADConfigResultData, Void> {

    public static final String TABLENAME = "ADCONFIG_RESULT_DATA";

    /**
     * Properties of entity ADConfigResultData.<br/>
     * Can be used for QueryBuilder and for referencing column names.
     */
    public static class Properties {
        public final static Property AdStartup = new Property(0, String.class, "adStartup", false, "AD_STARTUP");
        public final static Property AdBookshelfBanner = new Property(1, String.class, "adBookshelfBanner", false, "AD_BOOKSHELF_BANNER");
        public final static Property AdBookshelf = new Property(2, String.class, "adBookshelf", false, "AD_BOOKSHELF");
        public final static Property AdSearch = new Property(3, String.class, "adSearch", false, "AD_SEARCH");
        public final static Property AdSearchResult = new Property(4, String.class, "adSearchResult", false, "AD_SEARCH_RESULT");
        public final static Property AdReadTop = new Property(5, String.class, "adReadTop", false, "AD_READ_TOP");
        public final static Property AdReadBottom = new Property(6, String.class, "adReadBottom", false, "AD_READ_BOTTOM");
        public final static Property AdReadPage = new Property(7, String.class, "adReadPage", false, "AD_READ_PAGE");
        public final static Property AdReadBanner = new Property(8, String.class, "adReadBanner", false, "AD_READ_BANNER");
        public final static Property AdReadPopup = new Property(9, String.class, "adReadPopup", false, "AD_READ_POPUP");
        public final static Property AdDownload = new Property(10, String.class, "adDownload", false, "AD_DOWNLOAD");
        public final static Property AdNovel = new Property(11, String.class, "adNovel", false, "AD_NOVEL");
    }

    private final ADConfigDataConvert adStartupConverter = new ADConfigDataConvert();
    private final ADConfigDataConvert adBookshelfBannerConverter = new ADConfigDataConvert();
    private final ADConfigDataConvert adBookshelfConverter = new ADConfigDataConvert();
    private final ADConfigDataConvert adSearchConverter = new ADConfigDataConvert();
    private final ADConfigDataConvert adSearchResultConverter = new ADConfigDataConvert();
    private final ADConfigDataConvert adReadTopConverter = new ADConfigDataConvert();
    private final ADConfigDataConvert adReadBottomConverter = new ADConfigDataConvert();
    private final ADConfigDataConvert adReadPageConverter = new ADConfigDataConvert();
    private final ADConfigDataConvert adReadBannerConverter = new ADConfigDataConvert();
    private final ADConfigDataConvert adReadPopupConverter = new ADConfigDataConvert();
    private final ADConfigDataConvert adDownloadConverter = new ADConfigDataConvert();
    private final ADConfigDataConvert adNovelConverter = new ADConfigDataConvert();

    public ADConfigResultDataDao(DaoConfig config) {
        super(config);
    }
    
    public ADConfigResultDataDao(DaoConfig config, DaoSession daoSession) {
        super(config, daoSession);
    }

    /** Creates the underlying database table. */
    public static void createTable(Database db, boolean ifNotExists) {
        String constraint = ifNotExists? "IF NOT EXISTS ": "";
        db.execSQL("CREATE TABLE " + constraint + "\"ADCONFIG_RESULT_DATA\" (" + //
                "\"AD_STARTUP\" TEXT," + // 0: adStartup
                "\"AD_BOOKSHELF_BANNER\" TEXT," + // 1: adBookshelfBanner
                "\"AD_BOOKSHELF\" TEXT," + // 2: adBookshelf
                "\"AD_SEARCH\" TEXT," + // 3: adSearch
                "\"AD_SEARCH_RESULT\" TEXT," + // 4: adSearchResult
                "\"AD_READ_TOP\" TEXT," + // 5: adReadTop
                "\"AD_READ_BOTTOM\" TEXT," + // 6: adReadBottom
                "\"AD_READ_PAGE\" TEXT," + // 7: adReadPage
                "\"AD_READ_BANNER\" TEXT," + // 8: adReadBanner
                "\"AD_READ_POPUP\" TEXT," + // 9: adReadPopup
                "\"AD_DOWNLOAD\" TEXT," + // 10: adDownload
                "\"AD_NOVEL\" TEXT);"); // 11: adNovel
    }

    /** Drops the underlying database table. */
    public static void dropTable(Database db, boolean ifExists) {
        String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"ADCONFIG_RESULT_DATA\"";
        db.execSQL(sql);
    }

    @Override
    protected final void bindValues(DatabaseStatement stmt, ADConfigResultData entity) {
        stmt.clearBindings();
 
        ADConfigData adStartup = entity.getAdStartup();
        if (adStartup != null) {
            stmt.bindString(1, adStartupConverter.convertToDatabaseValue(adStartup));
        }
 
        ADConfigData adBookshelfBanner = entity.getAdBookshelfBanner();
        if (adBookshelfBanner != null) {
            stmt.bindString(2, adBookshelfBannerConverter.convertToDatabaseValue(adBookshelfBanner));
        }
 
        ADConfigData adBookshelf = entity.getAdBookshelf();
        if (adBookshelf != null) {
            stmt.bindString(3, adBookshelfConverter.convertToDatabaseValue(adBookshelf));
        }
 
        ADConfigData adSearch = entity.getAdSearch();
        if (adSearch != null) {
            stmt.bindString(4, adSearchConverter.convertToDatabaseValue(adSearch));
        }
 
        ADConfigData adSearchResult = entity.getAdSearchResult();
        if (adSearchResult != null) {
            stmt.bindString(5, adSearchResultConverter.convertToDatabaseValue(adSearchResult));
        }
 
        ADConfigData adReadTop = entity.getAdReadTop();
        if (adReadTop != null) {
            stmt.bindString(6, adReadTopConverter.convertToDatabaseValue(adReadTop));
        }
 
        ADConfigData adReadBottom = entity.getAdReadBottom();
        if (adReadBottom != null) {
            stmt.bindString(7, adReadBottomConverter.convertToDatabaseValue(adReadBottom));
        }
 
        ADConfigData adReadPage = entity.getAdReadPage();
        if (adReadPage != null) {
            stmt.bindString(8, adReadPageConverter.convertToDatabaseValue(adReadPage));
        }
 
        ADConfigData adReadBanner = entity.getAdReadBanner();
        if (adReadBanner != null) {
            stmt.bindString(9, adReadBannerConverter.convertToDatabaseValue(adReadBanner));
        }
 
        ADConfigData adReadPopup = entity.getAdReadPopup();
        if (adReadPopup != null) {
            stmt.bindString(10, adReadPopupConverter.convertToDatabaseValue(adReadPopup));
        }
 
        ADConfigData adDownload = entity.getAdDownload();
        if (adDownload != null) {
            stmt.bindString(11, adDownloadConverter.convertToDatabaseValue(adDownload));
        }
 
        ADConfigData adNovel = entity.getAdNovel();
        if (adNovel != null) {
            stmt.bindString(12, adNovelConverter.convertToDatabaseValue(adNovel));
        }
    }

    @Override
    protected final void bindValues(SQLiteStatement stmt, ADConfigResultData entity) {
        stmt.clearBindings();
 
        ADConfigData adStartup = entity.getAdStartup();
        if (adStartup != null) {
            stmt.bindString(1, adStartupConverter.convertToDatabaseValue(adStartup));
        }
 
        ADConfigData adBookshelfBanner = entity.getAdBookshelfBanner();
        if (adBookshelfBanner != null) {
            stmt.bindString(2, adBookshelfBannerConverter.convertToDatabaseValue(adBookshelfBanner));
        }
 
        ADConfigData adBookshelf = entity.getAdBookshelf();
        if (adBookshelf != null) {
            stmt.bindString(3, adBookshelfConverter.convertToDatabaseValue(adBookshelf));
        }
 
        ADConfigData adSearch = entity.getAdSearch();
        if (adSearch != null) {
            stmt.bindString(4, adSearchConverter.convertToDatabaseValue(adSearch));
        }
 
        ADConfigData adSearchResult = entity.getAdSearchResult();
        if (adSearchResult != null) {
            stmt.bindString(5, adSearchResultConverter.convertToDatabaseValue(adSearchResult));
        }
 
        ADConfigData adReadTop = entity.getAdReadTop();
        if (adReadTop != null) {
            stmt.bindString(6, adReadTopConverter.convertToDatabaseValue(adReadTop));
        }
 
        ADConfigData adReadBottom = entity.getAdReadBottom();
        if (adReadBottom != null) {
            stmt.bindString(7, adReadBottomConverter.convertToDatabaseValue(adReadBottom));
        }
 
        ADConfigData adReadPage = entity.getAdReadPage();
        if (adReadPage != null) {
            stmt.bindString(8, adReadPageConverter.convertToDatabaseValue(adReadPage));
        }
 
        ADConfigData adReadBanner = entity.getAdReadBanner();
        if (adReadBanner != null) {
            stmt.bindString(9, adReadBannerConverter.convertToDatabaseValue(adReadBanner));
        }
 
        ADConfigData adReadPopup = entity.getAdReadPopup();
        if (adReadPopup != null) {
            stmt.bindString(10, adReadPopupConverter.convertToDatabaseValue(adReadPopup));
        }
 
        ADConfigData adDownload = entity.getAdDownload();
        if (adDownload != null) {
            stmt.bindString(11, adDownloadConverter.convertToDatabaseValue(adDownload));
        }
 
        ADConfigData adNovel = entity.getAdNovel();
        if (adNovel != null) {
            stmt.bindString(12, adNovelConverter.convertToDatabaseValue(adNovel));
        }
    }

    @Override
    public Void readKey(Cursor cursor, int offset) {
        return null;
    }    

    @Override
    public ADConfigResultData readEntity(Cursor cursor, int offset) {
        ADConfigResultData entity = new ADConfigResultData( //
            cursor.isNull(offset + 0) ? null : adStartupConverter.convertToEntityProperty(cursor.getString(offset + 0)), // adStartup
            cursor.isNull(offset + 1) ? null : adBookshelfBannerConverter.convertToEntityProperty(cursor.getString(offset + 1)), // adBookshelfBanner
            cursor.isNull(offset + 2) ? null : adBookshelfConverter.convertToEntityProperty(cursor.getString(offset + 2)), // adBookshelf
            cursor.isNull(offset + 3) ? null : adSearchConverter.convertToEntityProperty(cursor.getString(offset + 3)), // adSearch
            cursor.isNull(offset + 4) ? null : adSearchResultConverter.convertToEntityProperty(cursor.getString(offset + 4)), // adSearchResult
            cursor.isNull(offset + 5) ? null : adReadTopConverter.convertToEntityProperty(cursor.getString(offset + 5)), // adReadTop
            cursor.isNull(offset + 6) ? null : adReadBottomConverter.convertToEntityProperty(cursor.getString(offset + 6)), // adReadBottom
            cursor.isNull(offset + 7) ? null : adReadPageConverter.convertToEntityProperty(cursor.getString(offset + 7)), // adReadPage
            cursor.isNull(offset + 8) ? null : adReadBannerConverter.convertToEntityProperty(cursor.getString(offset + 8)), // adReadBanner
            cursor.isNull(offset + 9) ? null : adReadPopupConverter.convertToEntityProperty(cursor.getString(offset + 9)), // adReadPopup
            cursor.isNull(offset + 10) ? null : adDownloadConverter.convertToEntityProperty(cursor.getString(offset + 10)), // adDownload
            cursor.isNull(offset + 11) ? null : adNovelConverter.convertToEntityProperty(cursor.getString(offset + 11)) // adNovel
        );
        return entity;
    }
     
    @Override
    public void readEntity(Cursor cursor, ADConfigResultData entity, int offset) {
        entity.setAdStartup(cursor.isNull(offset + 0) ? null : adStartupConverter.convertToEntityProperty(cursor.getString(offset + 0)));
        entity.setAdBookshelfBanner(cursor.isNull(offset + 1) ? null : adBookshelfBannerConverter.convertToEntityProperty(cursor.getString(offset + 1)));
        entity.setAdBookshelf(cursor.isNull(offset + 2) ? null : adBookshelfConverter.convertToEntityProperty(cursor.getString(offset + 2)));
        entity.setAdSearch(cursor.isNull(offset + 3) ? null : adSearchConverter.convertToEntityProperty(cursor.getString(offset + 3)));
        entity.setAdSearchResult(cursor.isNull(offset + 4) ? null : adSearchResultConverter.convertToEntityProperty(cursor.getString(offset + 4)));
        entity.setAdReadTop(cursor.isNull(offset + 5) ? null : adReadTopConverter.convertToEntityProperty(cursor.getString(offset + 5)));
        entity.setAdReadBottom(cursor.isNull(offset + 6) ? null : adReadBottomConverter.convertToEntityProperty(cursor.getString(offset + 6)));
        entity.setAdReadPage(cursor.isNull(offset + 7) ? null : adReadPageConverter.convertToEntityProperty(cursor.getString(offset + 7)));
        entity.setAdReadBanner(cursor.isNull(offset + 8) ? null : adReadBannerConverter.convertToEntityProperty(cursor.getString(offset + 8)));
        entity.setAdReadPopup(cursor.isNull(offset + 9) ? null : adReadPopupConverter.convertToEntityProperty(cursor.getString(offset + 9)));
        entity.setAdDownload(cursor.isNull(offset + 10) ? null : adDownloadConverter.convertToEntityProperty(cursor.getString(offset + 10)));
        entity.setAdNovel(cursor.isNull(offset + 11) ? null : adNovelConverter.convertToEntityProperty(cursor.getString(offset + 11)));
     }
    
    @Override
    protected final Void updateKeyAfterInsert(ADConfigResultData entity, long rowId) {
        // Unsupported or missing PK type
        return null;
    }
    
    @Override
    public Void getKey(ADConfigResultData entity) {
        return null;
    }

    @Override
    public boolean hasKey(ADConfigResultData entity) {
        // TODO
        return false;
    }

    @Override
    protected final boolean isEntityUpdateable() {
        return true;
    }
    
}
